package com.dzsw.item.controller;

import com.dzsw.item.config.JdbcConfig;
import com.dzsw.item.entity.Item;
import com.dzsw.item.service.ItemService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/item")
public class ItemController {

    @Autowired
    private ItemService itemService;

    @Resource
    private JdbcConfig jdbcConfig;

    /**
     * 对外提供接口服务，查询商品信息
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/query/{id}")
    public Item queryItemById(@PathVariable("id") Long id) {
        return this.itemService.queryItemById(id);
    }

    @GetMapping(value = "/testconfig")
    public String testconfig(){
        return this.jdbcConfig.toString();
    }
}
